package com.ruoyi.share.service.impl;

import java.util.List;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ruoyi.share.domain.ShareGoods;
import com.ruoyi.share.domain.ShareOrderForm;
import com.ruoyi.share.service.IShareOrderFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.share.mapper.ShareOrderFormMapper;

/**
 * 订单Service业务层处理
 *
 * @author ruoyi
 * @date 2021-11-16
 */
@Service
public class ShareOrderFormServiceImpl implements IShareOrderFormService
{
    @Autowired
    private ShareOrderFormMapper shareOrderFormMapper;

    /**
     * 查询订单
     *
     * @param id 订单主键
     * @return 订单
     */
    @Override
    public ShareOrderForm selectShareOrderFormById(Long id)
    {
        return shareOrderFormMapper.selectShareOrderFormById(id);
    }

    /**
     * 查询订单列表
     *
     * @param shareOrderForm 订单
     * @return 订单
     */
    @Override
    public List<ShareOrderForm> selectShareOrderFormList(ShareOrderForm shareOrderForm)
    {
        return shareOrderFormMapper.selectShareOrderFormList(shareOrderForm);
    }

    /**
     * 分页查询订单列表
     * @param shareOrderForm 订单
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public List<ShareOrderForm> selectShareOrderListPage(ShareOrderForm shareOrderForm, Integer pageNum, Integer pageSize) {
        //创建Page对象
        Page<ShareOrderForm> page;
        //启动分页
        PageHelper.startPage(pageNum, pageSize);
        //查询
        page = (Page<ShareOrderForm>) shareOrderFormMapper.selectShareOrderFormList(shareOrderForm);
        return page;
    }

    /**
     * 新增订单
     *
     * @param shareOrderForm 订单
     * @return 结果
     */
    @Override
    public int insertShareOrderForm(ShareOrderForm shareOrderForm)
    {
        return shareOrderFormMapper.insertShareOrderForm(shareOrderForm);
    }

    /**
     * 修改订单
     *
     * @param shareOrderForm 订单
     * @return 结果
     */
    @Override
    public int updateShareOrderForm(ShareOrderForm shareOrderForm)
    {
        return shareOrderFormMapper.updateShareOrderForm(shareOrderForm);
    }

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的订单主键
     * @return 结果
     */
    @Override
    public int deleteShareOrderFormByIds(Long[] ids)
    {
        return shareOrderFormMapper.deleteShareOrderFormByIds(ids);
    }

    /**
     * 删除订单信息
     *
     * @param id 订单主键
     * @return 结果
     */
    @Override
    public int deleteShareOrderFormById(Long id)
    {
        return shareOrderFormMapper.deleteShareOrderFormById(id);
    }
}
